package com.witsight.cassandra.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.witsight.cassandra.cassandao.SimpleRepository;
import com.witsight.cassandra.dao.BaseCassandraRepository;
import com.witsight.cassandra.model.Simple;
import com.witsight.cassandra.model.SimpleKey;
import com.witsight.cassandra.service.SimpleService;

/**   
 * 说明：[]
 * @Title: SimpleServiceImpl.java 
 * @Package com.witsight.cassandra.service.impl 
 * @See: []
 * Copyright: Copyright (c) 2017
 * Company:sany huax witsight team by product
 * @author: penght  
 * @date: 2017年10月11日 下午3:10:41 
 * @version: V1.0
 *
 */
@Service
public class SimpleServiceImpl extends BaseCassandraServiceImpl<Simple, SimpleKey> implements SimpleService{
	@Autowired
	protected SimpleServiceImpl(SimpleRepository baseDao) {
		super(baseDao);
	}

	@Override
	public List<Simple> getAllData() {
		return getBaseDao().findAll();
	}

	@Override
	public Simple findSimpleWhereEIsMinistTest() {
		BaseCassandraRepository<Simple, SimpleKey> dao = getBaseDao();
		List<Simple> list = dao.findAll();
		Simple simple =list.size()>0?list.get(0):new Simple();
		for(Simple s : list){
//			Integer i=s.getE();
//			Integer j=simple.getE();
//			if(null==i) continue;
//			else if(null==j||i<j)
//				simple = s;
		}
		//Assert.isInstanceOf(SimpleRepository.class, dao,"only SimpleRepository is support here!");
		return simple;
	}

	@Override
	public void Save(Simple s) {
		getBaseDao().save(s);
		
	}
}
